[XEN] Small ioemul cleanup.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 23 Nov 2006 17:37:23 +0000 (17:37 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 23 Nov 2006 17:37:23 +0000 (17:37 +0000)
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/traps.c

index 120179d64036f2ce71b1d1dc72e85ce4e2d78e66..87f3f79491d598f1d1a325f19206f2a80fead000 100644 (file)
@@ -1046,8 +1046,7 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
     u8 opcode, modrm_reg = 0, modrm_rm = 0, rep_prefix = 0;
     unsigned int port, i, op_bytes = 4, data, rc;
     char io_emul_stub[16];
-    void (*io_emul)(struct cpu_user_regs *) __attribute__((__regparm__(1))) \
-        = (void*)&io_emul_stub[0];
+    void (*io_emul)(struct cpu_user_regs *) __attribute__((__regparm__(1)));
     u32 l, h;
 
     /* Legacy prefixes. */
@@ -1190,6 +1189,9 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
     *(s32 *)&io_emul_stub[9] =
         (char *)guest_to_host_gpr_switch - &io_emul_stub[13];
 
+    /* Handy function-typed pointer to the stub. */
+    io_emul = (void *)io_emul_stub;
+
     /* I/O Port and Interrupt Flag instructions. */
     switch ( opcode )
     {
@@ -1207,13 +1209,13 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
             if ( guest_inb_okay(port, v, regs) )
                 io_emul(regs);
             else
-                regs->eax = (regs->eax & ~0xffUL) | (u8)~0;
+                regs->eax |= (u8)~0;
             break;
         case 2:
             if ( guest_inw_okay(port, v, regs) )
                 io_emul(regs);
             else
-                regs->eax = (regs->eax & ~0xffffUL) | (u16)~0;
+                regs->eax |= (u16)~0;
             break;
         case 4:
             if ( guest_inl_okay(port, v, regs) )